<!DOCTYPE html>
<html>
{{template "head"}}
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">

{{template "header"}}
{{template "menu" .  }}

    <div class="content-wrapper">
        <section class="content-header">
            <h1>
                规则管理
            </h1>
            <ol class="breadcrumb">
                <li><a href="/admin/index/"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li class="active">规则管理</li>
            </ol>
        </section>

        <section class="content">
            <div class="row c-manager">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-body">
                            <div class="nav-tabs-custom">
                                <ul class="nav nav-tabs">
                                    <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">单条规则</a></li>
                                    <li>
                                        <a href="#tab_2" data-toggle="tab" aria-expanded="false">批量增加</a></li>
                                </ul>
                            </div>
                            <div class="tab-content">
                                <div class="tab-pane active" id="tab_1">
                                    <form class="form-horizontal" action="/admin/rules/new/" method="post">
                                        <div class="box-body">
                                            <input type="hidden" id="id">
                                            <input type="hidden" name="_csrf" value="{{.csrf_token}}">
                                            <div class="form-group">
                                                <label for="hostName" class="col-sm-2 control-label">匹配方式</label>
                                                <div class="col-sm-10">
                                                    <select class="form-control" name="type">
                                                        <option value="github">github</option>
                                                        <option value="gitlab">gitlab</option>
                                                        <option value="searchcode">searchcode</option>
                                                        <option value="app">app</option>
                                                        <option value="domain">domain</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="content" class="col-sm-2 control-label">规则内容</label>
                                                <div class="col-sm-10">
                                                    <input type="text" class="form-control" id="content" name="content"
                                                           placeholder="匹配关键字">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="content" class="col-sm-2 control-label">规则名称</label>
                                                <div class="col-sm-10">
                                                    <input type="text" class="form-control" id="caption" name="caption"
                                                           placeholder="规则名称">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="desc" class="col-sm-2 control-label">描述</label>

                                                <div class="col-sm-10">
                                                    <textarea name="desc" id="desc" class="form-control"></textarea>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="hostName" class="col-sm-2 control-label">状态</label>
                                                <div class="col-sm-10">
                                                    <select class="form-control" name="status">
                                                        <option value="1">enable</option>
                                                        <option value="0" selected>disable</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label for="remark" class="col-sm-2 control-label"></label>
                                                <div class="col-sm-10">
                                                    <input type="submit" value="提交" class="btn btn-primary">
                                                </div>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                                <div class="tab-pane" id="tab_2">
                                    <form class="form-horizontal" action="/admin/rules/batchnew/" method="post">
                                        <div class="col-sm-10">
                                            <div class="form-group">
                                                <textarea name="rules" id="rules" class="form-control"
                                                  placeholder="匹配方式|规则内容|规则名称|描述&#13;&#10;github|keyword|name|desc"
                                                  action="/admin/rules/batchnew/" method="post"></textarea>
                                            </div>
                                        </div>
                                        <div class="col-sm-10">
                                            <div class="form-group col-sm-3">
                                                <input type="submit" value="提交" class="btn btn-primary">
                                            </div>
                                            <div class="form-group col-sm-3">
                                                <input id="reset" type="button" value="重置" class="btn btn-primary">
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
</div>
<script>
    document.querySelector('#reset').addEventListener('click', () => {
        document.querySelector('#rules').value = '';
    })
</script>
<script src="/lib/jQuery/jquery-2.2.3.min.js"></script>
<script src="/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="/lib/datatables/jquery.dataTables.min.js"></script>
<script src="/lib/datatables/dataTables.bootstrap.min.js"></script>
<script src="/lib/adminLET2/js/app.min.js"></script>
<script src="/js/common.js"></script>
</body>
</html>
